<template>
  <el-card>
    <el-row :gutter="30">
      <el-col :span="6" align="center">
        <el-card shadow="always" class="card">
          独生子女数量:{{ aloneCount }}
        </el-card>
      </el-col>
      <el-col :span="6" align="center">
        <el-card shadow="always" class="card">
          城市户口学生数量:{{ cityCount }}
        </el-card>
      </el-col>
      <el-col :span="6" align="center">
        <el-card shadow="always" class="card">
          已成年学生数量:{{ ageCount }}
        </el-card>
      </el-col>
      <el-col :span="6" align="center">
        <el-card shadow="always" class="card">
          已接种新冠疫苗人数:{{ vaccineCount }}
        </el-card>
      </el-col>
    </el-row>
    <el-row style="margin-top: 20px">
      <el-card shadow="always" class="card">
        <el-button class="buttonCard" type="success" @click="openDialog">新增学生</el-button>
        <el-button class="buttonCard" type="warning" @click="open">删除选中</el-button>
        <el-button class="buttonCard" type="danger" @click="open2">删除全部</el-button>
        <el-table
            border
            ref="multipleTable"
            :data="studentList"
            tooltip-effect="dark"
            style="width: 100%;margin-top: 20px;"
            @selection-change="handleSelectionChange">
          <el-table-column type="selection" width="30" align="center"></el-table-column>
          <el-table-column prop="name" label="姓名" width="80" align="center"></el-table-column>
          <el-table-column prop="age" label="年龄" width="80" align="center"></el-table-column>
          <el-table-column prop="only" label="是否独生" width="80" align="center"></el-table-column>
          <el-table-column prop="hk" label="户口" width="80" align="center"></el-table-column>
          <el-table-column prop="phone" label="手机" width="140" align="center"></el-table-column>
          <el-table-column prop="idCard" label="身份证" width="180" align="center"></el-table-column>
          <el-table-column prop="address" label="地址" align="center"></el-table-column>
          <el-table-column prop="vaccine" label="新冠疫苗" width="80" align="center"></el-table-column>
          <el-table-column label="操作" width="180" align="center">
            <el-button type="danger" @click="open" size="mini">删除</el-button>
            <el-button @click="dialogFormVisible = true" size="mini">编辑</el-button>
          </el-table-column>
        </el-table>
      </el-card>
    </el-row>

   <myDialog ref="dialog"></myDialog>
  </el-card>
</template>

<script>
import {mapGetters, mapState} from 'vuex'
import myDialog from "@/components/ManagementInformationSystem/MyDialog.vue";
export default {
  name: 'Information-page',
  components:{
    myDialog
  },
  props: {},
  data: function () {
    return {
      radio: '0',
      radio2: '0',
      formLabelWidth: '120px',
      form: {
        name: '',
        age: '',
        address: '',
        phone: '',
        selfCard: '',
        region: ''
      },
      tableData: [
        {
          me: '的撒旦',
          age: '162222',
          only: '独生',
          hk: '上海户口',
          phone: '153444433232339',
          idCard: '433127200611036682',
          address: '上海市普陀区金沙江路 1518 弄',
          vaccine: '未接21111种',
          operate: '',
        }],
    };
  },
  created() {
    console.log(this.$store)
  },
  computed: {
    ...mapState(['studentList']),
    ...mapGetters(['aloneCount', 'cityCount', 'vaccineCount', 'ageCount']),


  },
  methods: {
    openDialog() {
      console.log(this.$refs.dialog)
    },

    add() {
      this.dialogFormVisible = false
      console.log(this.name)
      console.log(this.age)
      console.log(this.address)
      console.log(this.selfCard)
      console.log(this.region)

    },
    open() {
      this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$message({
          type: 'success',
          message: '删除成功!'
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    open2() {
      this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$message({
          type: 'success',
          message: '删除成功!'
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },

    handleSelectionChange(val) {
      this.multipleSelection = val;
    }
  }
}
</script>

<style scoped>


</style>

